#pragma once
/* 
#ifdef _WIN32 //Windows platform
    #include "windows_char.h"
#else
    #include "linux_keys.h"
#endif
 */

#include <vector>
#include <string>
#include "linux_keys.h"
//reference https://docs.rs/termion/1.5.6/src/termion/event.rs.html#55-99

enum KeyType{
    /// Backspace.
    Backspace = 0,
    /// Left arrow.
    Left = 1,
    /// Right arrow.
    Right = 2,
    /// Up arrow.
    Up =3,
    /// Down arrow.
    Down=4,
    /// Home key.
    Home=5,
    /// End key.
    End=6,
    /// Page Up key.
    PageUp=7,
    /// Page Down key.
    PageDown=8,
    /// Backward Tab key.
    BackTab=9,
    /// Delete key.
    Delete=10,
    /// Insert key.
    Insert=11,
    /// Function keys.
    ///
    /// Only function keys 1 through 12 are supported.
    F=12,
    /// Normal character.
    Char=13,
    /// Alt modified character.
    Alt=14,
    /// Ctrl modified character.
    ///
    /// Note that certain keys may not be modifiable with `ctrl`, due to limitations of terminals.
    Ctrl=15,
    /// Null byte.
    Null=16,
    /// Esc key.
    Esc=17,

    Invalid=18,
};


struct KeyCode{
    KeyType Type;
    int Code;
};

class ConsoleKeyReader{
public:
    ConsoleKeyReader();
    ~ConsoleKeyReader();
    KeyCode ReadKeyCode();
private:
    LinuxKeys _linux_reader;

    KeyCode parse_csi();
    //KeyCode parse_csi(char seq);
    void SplitString(const std::string& s, std::vector<std::string>& v, const std::string& c);
};

